home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / JAFO04.422 < prev    next >
Text File  |  1993-02-14  |  12KB  |  440 lines

  1. JAFO04D.MOD
  2. JAFO #1 @18868
  3. Fri Feb 12 1993 21:15:48
  4. ┌────────────────────────────────────────────────────────────────────────────┐
  5. │ Mod Name      : JAFO04D.MOD              Mod Author: JAFO 1@1     TerraNET │
  6. │ Difficulty    : █████▒▒▒▒▒                                1@8857  IceNET   │
  7. │ WWIV Version  : 4.22                                      1@8861  WWIVnet  │
  8. │ Mod Date      : 02/02/93                                  1@18868 WWIVLink │
  9. │ Files Affected: BBS.C, BBSUTL.C, COM.C, SHRINK.C, UTILITY.C, VARS.H        │
  10. │ Description   : Enhanced Main Menu & Transfer Prompts                      │
  11. └────────────────────────────────────────────────────────────────────────────┘
  12.  
  13. ══[ Description ]═════════════════════════════════════════════════════════════
  14.  
  15. This mod will change the way your main menu and transfer prompts work.
  16. Normally, if you type '>', a few line spaces occur and the new prompt
  17. appears below.  Here is an example:
  18.  
  19. T - 50:33:21
  20. [1] [SysOp Announcements] :>
  21.  
  22.  
  23. T - 50:33:19
  24. [2] [General] :
  25.  
  26. As you can see, if you wanted to go to sub #30, it could take up 5 screens
  27. to get there!  This mod will keep the prompt on the SAME line while you
  28. advance or retreat subs, as well as directories, IF the user has ANSI
  29. enabled.  If you have modified your prompts to include random quotes or
  30. something, and have more than 2 lines, I'd suggest not using this mod,
  31. because additional code will be required, and it will be very slow at 2400
  32. baud.
  33.  
  34. Revision B Note:  If you are using the original version of this mod,
  35.                   JAFO04, then I suggest you completely rip it out of
  36.                   your source and install this mod.  This one is far
  37.                   easier to install too!
  38.  
  39. Revision C Note:  There was a very minor bug in 2.0.  I forgot to add
  40.                   a single line in BBS.C so that while at WFC everything
  41.                   acts normally.  If you installed V2.0, you probably
  42.                   noticed everything was kinda screwy at WFC.
  43.  
  44.  
  45. Revision D Note:  This version of the mod now keeps the prompt on the same
  46.                   line when you press a valid sub/dir number.  This was a
  47.                   feature of the original mod, but was taken out of
  48.                   subsequent versions (not by design).  It has since been
  49.                   requested by many people, so it is in now.
  50.  
  51. ══[ Legend ]══════════════════════════════════════════════════════════════════
  52.  
  53.   =  Existing line - Do not change
  54.   $  Existing line - Line has wrapped from previous line
  55.   +  Add this line
  56.   -  Remove this line
  57.   %  Change this line
  58.  
  59. ══[ Step 1 ]══════════════════════════════════════════════════════════════════
  60.  
  61. Please back up your source code.  Even the best programmers make mistakes.
  62.  
  63. ══[ Step 2 ]══════════════════════════════════════════════════════════════════
  64.  
  65. In VARS.H, change the line shown.  You are adding the "newline" variable.
  66.  
  67. =               userfile, usernum, useron, use_workspace, using_modem,
  68. %               wfc, x_only, newline;
  69. =
  70. = __EXTRN__ unsigned short com_speed, *csn_index, crc, *gat, modem_flag,
  71. =                          modem_mode, modem_speed, net_sysnum;
  72.  
  73. ══[ Step 3 ]══════════════════════════════════════════════════════════════════
  74.  
  75. In BBS.C, add the the following line near the top.
  76.  
  77. = #define _DEFINE_GLOBALS_
  78. = #include "vars.h"
  79. = #include "subxtr.h"
  80. =
  81. =
  82. = #include <math.h>
  83. + #include <ctype.h>
  84. =
  85. =
  86. = unsigned _stklen=15360;
  87.  
  88. ══[ Step 4 ]══════════════════════════════════════════════════════════════════
  89.  
  90. Put the following function right before "int checkpw".
  91.  
  92. void prompt(char *s)
  93. {
  94.   if ((okansi()) && (!newline))
  95.     outstr("\r\x1b[1A");
  96.   else
  97.     nl();
  98.   tleft(1);
  99.   npr("T - %s\r\n",ctim(nsl()));
  100.   prt(2,s);
  101.   if ((okansi()) && (!newline))
  102.     outstr("\x1b[K");
  103.   newline=0;
  104. }
  105.  
  106. ══[ Step 5 ]══════════════════════════════════════════════════════════════════
  107.  
  108. In "void mainmenu", make the changes shown.
  109.  
  110. = void mainmenu(void)
  111. = {
  112. =   char *s, s1[81],s2[81],ch;
  113. %   int i,i1;
  114. =   long l;
  115. =   double d;
  116. =
  117. =   tleft(1);
  118. =   if ((sysstatus_expert & thisuser.sysstatus)==0)
  119. =     printmenu(0);
  120. =
  121. -   nl();
  122. -   nl();
  123. -   tleft(1);
  124. -   npr("T - %s\r\n",ctim(nsl()));
  125. =   s1[0]=0;
  126. =   if (usub[cursub].subnum==-1) {
  127. =     cursub=0;
  128. =     if (usub[cursub].subnum==-1) {
  129. =       strcpy(s1,get_string(16));
  130. =     }
  131. =   }
  132. =   if (s1[0]==0)
  133. =     sprintf(s1,"[%s] [%s] :",usub[cursub].keys,
  134. $             subboards[usub[cursub].subnum].name);
  135. +   prompt(s1);
  136. -   prt(2,s1);
  137. =   helpl=1;
  138. =   s=mmkey(0);
  139. =   helpl=0;
  140. %   if (s[0]) {
  141. +     i1=0;
  142. %     for (i=0; (i<num_subs) && (usub[i].subnum!=-1); i++) {
  143. %       if (strcmp(usub[i].keys,s)==0) {
  144. =         cursub=i;
  145. +         i1=1;
  146. +       }
  147. +     }
  148. +     if ((!i1) && (okansi()) && (isdigit(s[0])) &&
  149. +        ((sysstatus_expert & thisuser.sysstatus)!=0)) {
  150. +       nl();
  151. +       newline=1;
  152. +     }
  153. +   } else
  154. +     newline=1;
  155. =   if (strlen(s)>2) {
  156. =     sprintf(s1,"//%s",s);
  157. =     sysopchar(s1);
  158.  
  159. ══[ Step 6 ]══════════════════════════════════════════════════════════════════
  160.  
  161. In "void dlmainmenu", make the changes shown.
  162.  
  163. = void dlmainmenu(void)
  164. = {
  165. =   char *s, s1[81],s2[81],ch;
  166. =   int i,i1,i2,abort,next;
  167. =   messagerec m;
  168. =
  169. =   tleft(1);
  170. =   if ((sysstatus_expert & thisuser.sysstatus)==0)
  171. =     printmenu(3);
  172. =
  173. -   nl();
  174. -   nl();
  175. -   tleft(1);
  176. -   npr("T - %s\r\n",ctim(nsl()));
  177. =   s1[0]=0;
  178. =   if (udir[curdir].subnum==-1) {
  179. =     curdir=0;
  180. =     if (udir[curdir].subnum==-1) {
  181. =       strcpy(s1,get_string(32));
  182. =       curdloads=0;
  183. =       return;
  184. =     }
  185. =   }
  186. =   if (s1[0]==0)
  187. =     sprintf(s1,"(%s)-(%s) :",udir[curdir].keys,
  188. $             directories[udir[curdir].subnum].name);
  189. +   prompt(s1);
  190. -   prt(2,s1);
  191. =   helpl=2;
  192. =   s=mmkey(1);
  193. =   helpl=0;
  194. %   if (s[0]) {
  195. +     i1=0;
  196. %     for (i=0; i<num_dirs; i++) {
  197. %       if (strcmp(udir[i].keys,s)==0) {
  198. =         curdir=i;
  199. +         i1=1;
  200. +       }
  201. +     }
  202. +     if ((!i1) && (okansi()) && (isdigit(s[0])) &&
  203. +        ((sysstatus_expert & thisuser.sysstatus)!=0)) {
  204. +       nl();
  205. +       newline=1;
  206. +     }
  207. +   } else
  208. +     newline=1;
  209. =   if (strlen(s)>2) {
  210. =     sprintf(s1,"//%s",s);
  211. =     sysopchar(s1);
  212.  
  213. ══[ Step 7 ]══════════════════════════════════════════════════════════════════
  214.  
  215. In BBSUTL.C, add the following line near the top.
  216.  
  217. = #include "vars.h"
  218. + #include <ctype.h>
  219. =
  220. = #pragma hdrstop
  221.  
  222. ══[ Step 8 ]══════════════════════════════════════════════════════════════════
  223.  
  224. Replace the entire "char *mmkey" function with the one below.
  225.  
  226. char *mmkey(int dl)
  227. {
  228.   static unsigned char cmd1[10],cmd2[81],ch;
  229.   int i,i1,i2,p,cp,expert;
  230.  
  231.   if ((sysstatus_expert & thisuser.sysstatus)==0)
  232.     expert=0;
  233.   else
  234.     expert=1;
  235.   do {
  236.     do {
  237.       ch=getkey();
  238.     } while ((((ch<' ') && (ch!=13)) || (ch>126)) && (hangup==0));
  239.     ch=upcase(ch);
  240.     outchr(ch);
  241.     if (ch==13)
  242.       cmd1[0]=0;
  243.     else
  244.       cmd1[0]=ch;
  245.     cmd1[1]=0;
  246.     p=0;
  247.     switch(dl) {
  248.  
  249.     case 1:
  250.       if (strchr(dtc,ch)!=NULL)
  251.         p=2;
  252.       else if (strchr(dcd,ch)!=NULL)
  253.         p=1;
  254.       break;
  255.     case 2:
  256.       if (strchr(odc,ch)!=NULL)
  257.         p=1;
  258.       break;
  259.     case 0:
  260.       if (strchr(tc,ch)!=NULL)
  261.         p=2;
  262.       else if (strchr(dc,ch)!=NULL)
  263.         p=1;
  264.       break;
  265.     }
  266.     if (p) {
  267.       cp=1;
  268.       do {
  269.         do {
  270.           ch=getkey();
  271.         } while ((((ch<' ') && (ch!=13) && (ch!=8)) || (ch>126))&&(hangup==0));
  272.         ch=upcase(ch);
  273.         if (ch==13) {
  274.           if ((!okansi()) || (!expert))
  275.             nl();
  276.           if (!expert)
  277.             newline=1;
  278.           return(cmd1);
  279.         } else {
  280.           if (ch==8) {
  281.             backspace();
  282.             cmd1[--cp]=0;
  283.           } else {
  284.             cmd1[cp++]=ch;
  285.             cmd1[cp]=0;
  286.             outchr(ch);
  287.             if ((ch=='/') && (cmd1[0]=='/')) {
  288.               input(cmd2,50);
  289.               if (((curdloads!=0) && (curdloads!=1) && (dl!=2)) ||
  290.                    (!newline)) {
  291.                 if (isdigit(cmd2[0])) {
  292.                   if ((curdloads==0) && (dl==0)) {
  293.                     i1=0;
  294.                     for (i=0; (i<num_subs) && (usub[i].subnum!=-1); i++)
  295.                       if (strcmp(usub[i].keys,cmd2)==0)
  296.                         i1=1;
  297.                     if (i1)
  298.                       nl();
  299.                   }
  300.                   if ((curdloads==1) && (dl==1)) {
  301.                     i1=0;
  302.                     for (i=0; i<num_dirs; i++)
  303.                       if (strcmp(udir[i].keys,cmd2)==0)
  304.                         i1=1;
  305.                     if (i1)
  306.                       nl();
  307.                   }
  308.                   if (dl==2)
  309.                     nl();
  310.                 } else
  311.                   nl();
  312.                 newline=1;
  313.               }
  314.               return(cmd2);
  315.             } else if (cp==p+1) {
  316.               if (((curdloads!=0) && (curdloads!=1) && (dl!=2)) ||
  317.                    (!newline)) {
  318.                 if (isdigit(cmd1[0])) {
  319.                   if ((dl==2) || (!okansi()) || (!expert))
  320.                     nl();
  321.                   if (!expert)
  322.                     newline=1;
  323.                 } else {
  324.                   nl();
  325.                   newline=1;
  326.                 }
  327.               } else {
  328.                 nl();
  329.                 newline=1;
  330.               }
  331.               return(cmd1);
  332.             }
  333.           }
  334.         }
  335.       } while (cp);
  336.     } else {
  337.       if (((curdloads!=0) && (curdloads!=1) && (dl!=2)) ||
  338.            (!newline)) {
  339.         switch (cmd1[0]) {
  340.           case '>':
  341.           case '+':
  342.           case '<':
  343.           case '-':
  344.             if ((dl==2) || (!okansi()) || (!expert))
  345.               nl();
  346.             if (!expert)
  347.               newline=1;
  348.             break;
  349.           default:
  350.             if (isdigit(cmd1[0])) {
  351.               if ((dl==2) || (!okansi()) || (!expert))
  352.                 nl();
  353.               if (!expert)
  354.                 newline=1;
  355.             } else {
  356.               nl();
  357.               newline=1;
  358.             }
  359.             break;
  360.         }
  361.       } else {
  362.         nl();
  363.         newline=1;
  364.       }
  365.       return(cmd1);
  366.     }
  367.   } while (hangup==0);
  368.   cmd1[0]=0;
  369.   return(cmd1);
  370. }
  371.  
  372. ══[ Step 9 ]══════════════════════════════════════════════════════════════════
  373.  
  374. In COM.C, change the following line in "void input1".
  375.  
  376. =           case 13:
  377. =             s[curpos] = 0;
  378. =           done = echo = 1;
  379. %             if ((newline) && (crend))
  380. =               nl();
  381. =             break;
  382.  
  383. ══[ Step 10 ]═════════════════════════════════════════════════════════════════
  384.  
  385. In SHRINK.C, add the following line to "int restore_data".
  386.  
  387. =     READ(numbatch);
  388. =     READ(numbatchdl);
  389. +     READ(newline);
  390. =
  391. =     read(f,batch, numbatch*sizeof(batchrec));
  392.  
  393. ══[ Step 11 ]═════════════════════════════════════════════════════════════════
  394.  
  395. Add the following line in "void save_state".
  396.  
  397. =   WRITE(numbatch);
  398. =   WRITE(numbatchdl);
  399. +   WRITE(newline);
  400. =
  401. =   write(f,batch, numbatch*sizeof(batchrec));
  402.  
  403.  
  404. ══[ Step 12 ]═════════════════════════════════════════════════════════════════
  405.  
  406. In UTILITY.C, add the following line to "void frequent_init".
  407.  
  408. = void frequent_init(void)
  409. = /* This should be called after a user is logged off, and will initialize
  410. =  * screen-access variables.
  411. =  */
  412. = {
  413. =   in_fsed=0;
  414. =   curlsub=-1;
  415. =   ansiptr=0;
  416. +   newline=1;
  417. =   curatr=0x07;
  418. =   outcom=0;
  419. =   incom=0;
  420.  
  421. ══[ Step 13 ]═════════════════════════════════════════════════════════════════
  422.  
  423. Compile your source.  Since we added a variable to VARS.H, a full re-compile
  424. is necessary.
  425.  
  426. ══[ Disclaimer ]══════════════════════════════════════════════════════════════
  427.  
  428. Don't complain to me if your board gets fried, your hard disk goes nuts, or
  429. something terrible happens.  The code in this mod should be harmless, but I
  430. can't guarantee it will work for you.  It works on my board.
  431.  
  432. JAFO 1@1     TerraNET
  433.      1@8857  IceNET
  434.      1@8861  WWIVnet
  435.      1@18868 WWIVLink
  436.           7───────────────────── 1Blue Thunder BBS 7─────────────────────
  437.  
  438.           1TerraNET @1 7∙ 1IceNET @8857 7∙ 1WWIVnet @8861 7∙ 1WWIVLink @188680
  439.  
  440.